/**
 * @file categories/graph/dfs/cf780c/main.cpp
 * @brief
 * @see https://codeforces.com/contest/780/submission/162972713
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/6 15:17:02
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 2e5 + 10;
int color[N];
vi adj[N];
int nColor;
int n;
void dfs(int u, int p) {
  int parColor = color[p];
  int curColor = color[u];
  int sonColor = 0;
  for (auto v : adj[u]) {
    if (v == p) continue;
    sonColor = (sonColor + 1) % nColor;
    while (sonColor == parColor || sonColor == curColor)
      sonColor = (sonColor + 1) % nColor;
    color[v] = sonColor;
    dfs(v, u);
  }
}

int main() {
  // High rating and good luck!
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  int maxOut = -1;
  for (int i = 1; i <= n; ++i) {
    maxOut = max(maxOut, (int)adj[i].size());
  }
  nColor = maxOut + 1;
  cout << nColor << '\n';
  color[1] = 0;
  int sonColor = 1;
  for (auto v : adj[1]) {
    color[v] = sonColor;
    sonColor++;
    dfs(v, 1);
  }
  for (int i = 1; i <= n; ++i) {
    cout << color[i] + 1 << ' ';
  }
  cout << endl;
  return 0;
}
